package homework.newenergycharging;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;

public class DataPreparation {
    public static void main(String[] args) throws IOException {
        // 获取HDFS⽂件系统对象
        Configuration conf = new Configuration();
        conf.set("fs.defaultFS", "hdfs://hadoop-svr-01:9000");
        FileSystem hdfs = FileSystem.get(conf);
        // 创建要操作的⽂件对象
        Path path = new Path("D:\\DataProcessing\\projects_dp\\wu_hadoop\\src\\main\\resources\\nvv2t_md.csv");
        Path dst = new Path("/homework/newenergycharging/data_input/nvv2t_md.csv");
        // 上传⽂件
        hdfs.copyFromLocalFile(path, dst);
        System.out.println("⽂件上传完成");
    }
}